(0) Obligation:

Clauses:

gopher(nil, L) :- ','(!, eq(L, nil)).
gopher(X, Y) :- ','(head(X, nil), ','(!, ','(tail(X, T), eq(Y, cons(nil, T))))).
gopher(X, Y) :- ','(head(X, H), ','(head(H, U), ','(tail(H, V), ','(tail(X, W), gopher(cons(U, cons(V, W)), Y))))).
head([], X1).
head(.(X, X2), X).
tail([], []).
tail(.(X3, X), X).
eq(X, X).

Query: gopher(g,a)

(1) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph ICLP10.

(2) Obligation:

Clauses:

gopherA(nil, nil).
gopherA([], cons(nil, [])).
gopherA(.(nil, T31), cons(nil, T31)).
gopherA(.(.(T83, T84), T85), T39) :- gopherA(cons(T83, cons(T84, T85)), T39).

Query: gopherA(g,a)

(3) PrologToPiTRSProof (SOUND transformation)

We use the technique of [TOCL09]. With regard to the inferred argument filtering the predicates were used in the following modes:
gopherA_in: (b,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

gopherA_in_ga(nil, nil) → gopherA_out_ga(nil, nil)
gopherA_in_ga([], cons(nil, [])) → gopherA_out_ga([], cons(nil, []))
gopherA_in_ga(.(nil, T31), cons(nil, T31)) → gopherA_out_ga(.(nil, T31), cons(nil, T31))
gopherA_in_ga(.(.(T83, T84), T85), T39) → U1_ga(T83, T84, T85, T39, gopherA_in_ga(cons(T83, cons(T84, T85)), T39))
U1_ga(T83, T84, T85, T39, gopherA_out_ga(cons(T83, cons(T84, T85)), T39)) → gopherA_out_ga(.(.(T83, T84), T85), T39)

The argument filtering Pi contains the following mapping:
gopherA_in_ga(x1, x2)  =  gopherA_in_ga(x1)
nil  =  nil
gopherA_out_ga(x1, x2)  =  gopherA_out_ga(x2)
[]  =  []
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
cons(x1, x2)  =  cons(x1, x2)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

Pi-finite rewrite system:
The TRS R consists of the following rules:

gopherA_in_ga(nil, nil) → gopherA_out_ga(nil, nil)
gopherA_in_ga([], cons(nil, [])) → gopherA_out_ga([], cons(nil, []))
gopherA_in_ga(.(nil, T31), cons(nil, T31)) → gopherA_out_ga(.(nil, T31), cons(nil, T31))
gopherA_in_ga(.(.(T83, T84), T85), T39) → U1_ga(T83, T84, T85, T39, gopherA_in_ga(cons(T83, cons(T84, T85)), T39))
U1_ga(T83, T84, T85, T39, gopherA_out_ga(cons(T83, cons(T84, T85)), T39)) → gopherA_out_ga(.(.(T83, T84), T85), T39)

The argument filtering Pi contains the following mapping:
gopherA_in_ga(x1, x2)  =  gopherA_in_ga(x1)
nil  =  nil
gopherA_out_ga(x1, x2)  =  gopherA_out_ga(x2)
[]  =  []
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
cons(x1, x2)  =  cons(x1, x2)

(5) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LOPSTR] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

GOPHERA_IN_GA(.(.(T83, T84), T85), T39) → U1_GA(T83, T84, T85, T39, gopherA_in_ga(cons(T83, cons(T84, T85)), T39))
GOPHERA_IN_GA(.(.(T83, T84), T85), T39) → GOPHERA_IN_GA(cons(T83, cons(T84, T85)), T39)

The TRS R consists of the following rules:

gopherA_in_ga(nil, nil) → gopherA_out_ga(nil, nil)
gopherA_in_ga([], cons(nil, [])) → gopherA_out_ga([], cons(nil, []))
gopherA_in_ga(.(nil, T31), cons(nil, T31)) → gopherA_out_ga(.(nil, T31), cons(nil, T31))
gopherA_in_ga(.(.(T83, T84), T85), T39) → U1_ga(T83, T84, T85, T39, gopherA_in_ga(cons(T83, cons(T84, T85)), T39))
U1_ga(T83, T84, T85, T39, gopherA_out_ga(cons(T83, cons(T84, T85)), T39)) → gopherA_out_ga(.(.(T83, T84), T85), T39)

The argument filtering Pi contains the following mapping:
gopherA_in_ga(x1, x2)  =  gopherA_in_ga(x1)
nil  =  nil
gopherA_out_ga(x1, x2)  =  gopherA_out_ga(x2)
[]  =  []
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
cons(x1, x2)  =  cons(x1, x2)
GOPHERA_IN_GA(x1, x2)  =  GOPHERA_IN_GA(x1)
U1_GA(x1, x2, x3, x4, x5)  =  U1_GA(x5)

We have to consider all (P,R,Pi)-chains

(6) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

GOPHERA_IN_GA(.(.(T83, T84), T85), T39) → U1_GA(T83, T84, T85, T39, gopherA_in_ga(cons(T83, cons(T84, T85)), T39))
GOPHERA_IN_GA(.(.(T83, T84), T85), T39) → GOPHERA_IN_GA(cons(T83, cons(T84, T85)), T39)

The TRS R consists of the following rules:

gopherA_in_ga(nil, nil) → gopherA_out_ga(nil, nil)
gopherA_in_ga([], cons(nil, [])) → gopherA_out_ga([], cons(nil, []))
gopherA_in_ga(.(nil, T31), cons(nil, T31)) → gopherA_out_ga(.(nil, T31), cons(nil, T31))
gopherA_in_ga(.(.(T83, T84), T85), T39) → U1_ga(T83, T84, T85, T39, gopherA_in_ga(cons(T83, cons(T84, T85)), T39))
U1_ga(T83, T84, T85, T39, gopherA_out_ga(cons(T83, cons(T84, T85)), T39)) → gopherA_out_ga(.(.(T83, T84), T85), T39)

The argument filtering Pi contains the following mapping:
gopherA_in_ga(x1, x2)  =  gopherA_in_ga(x1)
nil  =  nil
gopherA_out_ga(x1, x2)  =  gopherA_out_ga(x2)
[]  =  []
.(x1, x2)  =  .(x1, x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x5)
cons(x1, x2)  =  cons(x1, x2)
GOPHERA_IN_GA(x1, x2)  =  GOPHERA_IN_GA(x1)
U1_GA(x1, x2, x3, x4, x5)  =  U1_GA(x5)

We have to consider all (P,R,Pi)-chains

(7) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 0 SCCs with 2 less nodes.

(8) TRUE